package com.kongjs.common.datasource.properties;

import org.springframework.util.StringUtils;

import java.util.Properties;

public class DataSourceProperties extends Properties {

    public String getName() {
        return getProperty("name");
    }


    public String getType() {
        return getProperty("type");
    }


    public String getDriverClassName() {
        return getProperty("driverClassName", getProperty("driver-class-name"));
    }


    public String getUrl() {
        return getProperty("url");
    }


    public String getUsername() {
        return getProperty("username");
    }


    public String getPassword() {
        return getProperty("password");
    }

    public boolean isDefault() {
        String aDefault = getProperty("default");
        return StringUtils.hasText(aDefault) && (aDefault.equalsIgnoreCase("true") || aDefault.equalsIgnoreCase("on"));
    }
}
